﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using DailyDiet.Models;
using DailyDiet.Services;
using DailyDiet.Services.Impl;
using Moq;
using NUnit.Framework;

namespace DailyDietTest.Helper
{
    public static class DietRecorderStorageServiceTestHelper {
        private static IDietRecorderStorageService _dietRecorderStorageService;
        public static async Task<IDietRecorderStorageService> GetInitializedDietRecorderStorage() {
            if (_dietRecorderStorageService != null) {
                return _dietRecorderStorageService;
            }
            var preferenceMocked = new Mock<IPreferenceStorage>();
            var mockedPreference = preferenceMocked.Object;
            _dietRecorderStorageService =
                new DietRecorderStorageService(mockedPreference);
            await _dietRecorderStorageService.InitializeAsync();
            return _dietRecorderStorageService;
        }
    }
}
